#include<iostream>
#include<cstring>
#include<bitset>
using namespace std;
typedef long long LL;
const int N = 30;
int st[N];
LL a[N];
int n, k;
int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	/*for (int i = 1; i <= n; i++) {
		memset(st, 0, sizeof(st));
		dfs(0, 0, i);
	}*/
	//cout << (1 << 20) << endl;
	LL cnt = 0;
	for (LL i = 0; i <= (1 << n) - 1; i++) {
		bitset<64>f;
		for (int i = 0; i < 64; i++) {
			f[i] = 1;
		}
		for (int j = 0; j < 64; j++) {
			if ((i >> j) & 1) {
				//cout << "i==" << i << endl;
				//cout << "j==" << j << endl;
				f &= a[j];
			}
		}
		//cout << "f==" << f << endl;
		if (f.count() == k)cnt++;
	}
	cout << cnt << endl;
	return 0;
}